import axios from '@/utils/request';
const baseURL = process.env.VUE_APP_MAINTENANCE_API;
const deviceURL = process.env.VUE_APP_DEVICE_API;

// 获取物模型详情
const getModelDetail = data =>  axios.request({
  method: 'GET',
  url: deviceURL + '/device/getModelVariable',
  params: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 创建保养计划
const createPlan = data =>  axios.request({
  method: 'POST',
  url: baseURL + '/maintenance/addPlan',
  data: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 删除保养计划
const deletePlan = data =>  axios.request({
  method: 'DELETE',
  url: baseURL + '/maintenance/deletePlan',
  data: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 修改保养计划
const modifyPlan = data =>  axios.request({
  method: 'PUT',
  url: baseURL + '/maintenance/updatePlan',
  data: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 获取保养计划详情
const getPlanDetail = data =>  axios.request({
  method: 'GET',
  url: baseURL + '/maintenance/getPlanDetail',
  params: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

export { getModelDetail, createPlan, deletePlan, modifyPlan, getPlanDetail }
